﻿#include "smallerWeb.h"

smallerWeb::smallerWeb(QWidget* parent) :
    QWebEngineView(parent)
{
    connect(this, &smallerWeb::urlChanged, this,  & smallerWeb::onUrlChanged);
    viewList = NULL;

}

QWebEngineView* smallerWeb::createWindow(QWebEnginePage::WebWindowType type) {
    Q_UNUSED(type)
   
        if (viewList != NULL) {
            viewList->disconnect();
            delete viewList;
            viewList = NULL;
        }

    viewList = new QWebEngineView();
    connect(viewList, &QWebEngineView::urlChanged, this, &smallerWeb::onUrlChanged);
    return viewList;
}

void smallerWeb::onUrlChanged(QUrl url) {
    setUrl(url);
}